package hku.cs.lunuo;

import hku.cs.lunuo.rank.StmtResult;
import hku.cs.lunuo.rank.model.Model;
import hku.cs.lunuo.voter.Voter;
import hku.cs.lunuo.voter.impl.Tarantula;

import java.io.File;
import java.io.PrintStream;

public class Global {
	public final class Singleton {
		private Singleton() {
		}
	}
	private Singleton s = new Singleton();

	private static Global instance = new Global();

	public synchronized static Global v() {
		return instance;
	}

	public static synchronized void reset() {
		instance = new Global();
	}

	private hku.cs.lunuo.Main _Main;
	private hku.cs.lunuo.rank.RankMain __Main;

//	public hku.cs.lunuo.Main _Main() {
//		if (_Main == null)
//			_Main = new hku.cs.lunuo.Main(s);
//		return _Main;
//	}
	
	public hku.cs.lunuo.rank.RankMain _RankMain() {
		if (__Main == null)
			__Main = new hku.cs.lunuo.rank.RankMain (s);
		return __Main;
	}

	public Voter voter = new Tarantula();
	public Model model = null;
	public String modelName = null;
	public PrintStream out = System.out;
	public float faultRatio = 0;
	public StmtResult result = new StmtResult();
	public File toDoDir = null;
	public boolean exceptionFilter = false;
	public long esLength = 0;
	public long esNumber = 0;
	
	public void clear() {
		if(instance==null)
			instance = new Global();
		instance.esLength = 0;
		instance.esNumber = 0;
		instance.faultRatio = 0;
		instance.result.data.clear();
	}

}
